#include <iostream>
#include <string>
using namespace std;
int main(){
	string num;
	int n;
	cin>>num>>n;
	int temp=0,first=0;
	for(int i=0;i<num.length();i++){
		temp=temp*10+num[i]-48;
		if(temp>=n){
			cout<<temp/n;
			first=1;
		}else if(first){
			cout<<0;
		}
		temp=temp%n ;
	}
	if(first==0) cout<<0;
    cout<<" "<<temp<<endl;
}

